package com.oocl.euc.core.builder;

import com.oocl.euc.core.requestform.model.RequestRemarks;
import com.oocl.euc.core.requestform.repository.RequestRemarksRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RequestRemarkBuilder {

    private RequestRemarks requestRemarks;

    @Autowired
    private RequestRemarksRepository requestRemarksRepository;

    public RequestRemarkBuilder defaultBuilder() {
        this.requestRemarks = new RequestRemarks();
        return this;
    }

    public RequestRemarkBuilder withRefNo(String refNo) {
        this.requestRemarks.setRefNo(refNo);
        return this;
    }

    public RequestRemarkBuilder withDescription(String description) {
        this.requestRemarks.setDescription(description);
        return this;
    }

    public RequestRemarks create() {
        return this.requestRemarks;
    }

    public RequestRemarks saveToDB() {
        requestRemarksRepository.save(this.requestRemarks);
        return this.requestRemarks;
    }


}
